package cn.felord.core.bean;

/**
 * @author GaoJun.Zhou
 * @version 1.0
 */
public class Rest {

    private long code;

    private Object data;

    private String msg;

    public long getCode() {
        return code;
    }

    public void setCode(long code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    private Rest(long code, Object data, String msg) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

    public static Rest ok() {
        return new Rest(200, null, "");
    }

    public static Rest ok(String msg) {
        return new Rest(200, null, msg);
    }

    public static Rest okData(Object data) {
        return new Rest(200, data, "ok");
    }

    public static Rest failure(String msg) {
        return new Rest(500, null, msg);
    }
}
